#ifndef CONFIGURATION_H
#define CONFIGURATION_H

#include <QSettings>
#include <QString>
#include <QDir>

#include <sstream>

#include <faif/dna/Codon.h>


class ProteinUtils 
{

public:

	static char* printCodon(const faif::dna::Codon & codon)
	{	
      char* result = new char[3];
		//result = std::string(codon.getFirst().get()) + std::string(codon.getSecond().get()) + std::string(codon.getThird().get());
		result[0] = codon.getFirst().get();
		result[1] = codon.getSecond().get();
		result[2]  = codon.getThird().get();
		//return stream.str();
      return result;
	}

	
};


class Configuration
{
private:
	QSettings settings;
public:
	Configuration(void);
	~Configuration(void);

	double getEnergyToProbablity() {
		if (!settings.contains("energyToProbablity"))
			return 0.5;
		return settings.value("energyToProbablity").toDouble();
	}

	double getAmountOfRand() {
		if (!settings.contains("amountOfRand"))
			return 0.5;
		return settings.value("amountOfRand").toDouble();
	}

	double getCodonProbability(faif::dna::Codon codon) {
		QString codonString = ProteinUtils::printCodon(codon);//.c_str();
		codonString.resize(3);
		if (!settings.contains(codonString))
			return 0.5;
		return settings.value(codonString).toDouble();
	}

};





#endif //CONFIGURATION_H